package com.blb.springboot.config;

import com.blb.springboot.interceptor.LoginInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

//@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {

    //添加拦截器
    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        //在拦截器注册中添加自定义拦截器
        registry.addInterceptor(new LoginInterceptor())
                //配置拦截路径 /**代表所有路径
                .addPathPatterns("/**")
                //排除路径
                .excludePathPatterns("/**/world","/**/*.js","/**/*.css");
        super.addInterceptors(registry);
    }
}
